package com.lovo.es.controller;

import com.lovo.es.Entity.NewEntity;
import com.lovo.es.dao.INewsDao;
import com.lovo.es.dao.INewshibernate;
import com.lovo.es.service.NewsService;
import com.lovo.sysuntils.SnowIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/es")
public class EsController {

    @Autowired
    NewsService newsService;


    @RequestMapping("addNews")
    public String addNews(@RequestBody NewEntity entity) {

        String entityId = SnowIdUtils.uniqueLongHex();
        entity.setNewsId(entityId);

        newsService.addNews(entity);

        return "ok";
    }


}
